package com.translate.web.api.util;

import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;


public class FileReaderContent {  
  
    public static String read(InputStream in) {  
        BufferedReader reader = null;  
        
        try {  
            // 创建FileReader对象  
  
        	byte[] bytes = new byte[4096];
            
        	
        	ByteArrayOutputStream baos = new ByteArrayOutputStream();
        	
        	// 逐行读取文件内容  
            while (-1 != in.read(bytes)) {  
            	baos.write(bytes);
            }  
            
            return baos.toString("UTF-8");
        } catch (IOException e) {  
            e.printStackTrace();  
        } finally {  
            // 关闭文件读取流  
            try {  
                if (reader != null) {  
                    reader.close();  
                }  
            } catch (IOException e) {  
                e.printStackTrace();  
            }  
        }
		return null;  
    }
}